const router = require('koa-router')()
const db = require('../db/initdb')

router.post('/feedback', async (ctx, next) => {
  console.log(ctx.request.body)
  let content = ctx.request.body.content
  let userid = ctx.request.body.userid
  let tele = ctx.request.body.contact

  let sql = "INSERT INTO hs.return (userid, content,tele,date) VALUES ($1,$2,$3,$4)";
  let args = [userid, content, tele, new Date()]
  let ret = await db.query(sql, args);
  console.log(ret)
  ctx.body = { "status": 200 }
})

module.exports = router
